# 斗兽棋
from enum import Enum, unique, IntEnum


class ChessError(Exception):
    '下棋过程中的异常'

    def __init__(self, error_msg) -> None:
        self.error_msg = error_msg

    def __str__(self) -> str:
        return repr(self.error_msg)


@unique
class ChessType(IntEnum):
    '棋子类型'
    # 大象
    ELEPHANT = 7
    # 老虎
    TIGER = 6
    # 狼
    WOLF = 5
    # 狗
    DOG = 4
    # 猫
    CAT = 3
    # 足球 足球可以吃任何棋子，但中间必须隔一个或多个棋子
    FOOTBALL = 2
    # 老鼠 老鼠只能吃大象
    MOUSE = 1


@unique
class ChessColor(Enum):
    '棋子颜色'
    # 红色方
    RED = 'RED'
    # 蓝色方
    BLUE = 'BLUE'


LENGTH = 4
WIDTH = 9
CHESS_COMBINATIONS = {ChessType.ELEPHANT: 1,
                      ChessType.TIGER: 2,
                      ChessType.WOLF: 3,
                      ChessType.DOG: 3,
                      ChessType.CAT: 3,
                      ChessType.FOOTBALL: 2,
                      ChessType.MOUSE: 4}

CHESS_TYPES_DIC = {ChessType.ELEPHANT: {'label': '大象', 'graphic': []},
                   ChessType.TIGER: {'label': '老虎', 'graphic': []},
                   ChessType.WOLF: {'label': '狼', 'graphic': []},
                   ChessType.DOG: {'label': '狗', 'graphic': []},
                   ChessType.CAT: {'label': '猫', 'graphic': []},
                   ChessType.FOOTBALL: {'label': '足球', 'graphic': []},
                   ChessType.MOUSE: {'label': '老鼠', 'graphic': []},
                   }
